package com.example.shopping.controller.admin;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.shopping.pojo.Commodity;
import com.example.shopping.service.CommodityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/admin")
public class RecommendCon {
    @Autowired
    private CommodityService commodityService;

    @GetMapping("/recommendList")
    @ResponseBody
    public List<Commodity> recommendList(){
        QueryWrapper<Commodity> commodityQueryWrapper = new QueryWrapper<>();
        commodityQueryWrapper.eq("recommend",1);
        List<Commodity> list = commodityService.list(commodityQueryWrapper);
        return list;
    }
}
